//
//  HLMainSectionModel.h
//  s.
//
//  Created by fanshijian on 2022/8/24.
//  Copyright © 2022 J. All rights reserved.
//

#import <Foundation/Foundation.h>
#import "BaseModel.h"

NS_ASSUME_NONNULL_BEGIN

@interface MainSectionModel : NSObject <CHGCollectionViewSupplementaryElementModelProtocol,
CHGTableViewHeaderFooterModelProtocol>

/** header  */
+ (instancetype)sectionWithHeaderModel:(__kindof BaseModel *)model;
/** footer  */
+ (instancetype)sectionWithHeader:(__kindof BaseModel *_Nullable)head footer:(__kindof BaseModel *_Nullable)footer;

/// header  model data
@property (strong, nonatomic, nullable) __kindof BaseModel *h_model;
/// header  model data priority is higher than h_model
@property (copy, nonatomic, nullable) __kindof BaseModel *(^h_modelBlock)(MainSectionModel *sm);
/// footer model data
@property (strong, nonatomic, nullable) BaseModel *f_model;
/// footer model data priority hegher than f_model
@property (copy, nonatomic, nullable) BaseModel *(^f_modelBlock)(MainSectionModel *sm);
/// section 自定义背景
@property (copy, nonatomic) void (^decorator)(UIView *wrapper);
/// 自定义wrapper 用于渐变色背景处理
@property (copy, nonatomic) JYRStringBlock wrapperStringBlock;

/// 第几个section
@property (strong, nonatomic) NSNumber          *idx;

@property (assign, nonatomic) BOOL              pinHeader;

@property (strong, nonatomic) NSMutableArray    *items;
/// items.count
@property (readonly, nonatomic) NSUInteger      rowCount;
/// section间距
@property (assign, nonatomic) UIEdgeInsets      sectionInsets;

/// section间距优先级高于sectionInsets
@property (copy, nonatomic, nullable) UIEdgeInsets (^sectionInsetsBlock)(MainSectionModel *sm);

@property (assign, nonatomic) CGFloat lineSpacing;

@property (assign, nonatomic) CGFloat itemSpacing;
/// 数据源有改变
@property (assign, nonatomic) BOOL modified;

/// section的背景色
@property (strong, nonatomic) UIColor *sectionColor;

/// 是否靠左对齐 默认NO
@property (assign, nonatomic) BOOL layoutAlignLeft;

- (BaseModel *)getHeaderObj;

- (void)sectionInsets:(UIEdgeInsets)insets ls:(CGFloat)ls is:(CGFloat)is;

@end

NS_ASSUME_NONNULL_END
